import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import AccountView from '../views/AccountView.vue'
import FavouritesView from '../views/FavouritesView.vue'
import AddressView from '../views/AddressView.vue'
import RegisterView from '../views/RegisterView.vue'
import IndexView from '../views/IndexView.vue'
import SearchView from '../views/SearchView.vue'
import AboutView from '../views/AboutView.vue'
import AccIndex from '../views/AccIndex.vue'



const routes = [
  // {
  //   path: '/',
  //   name: 'home',
  //   component: HomeView,
  // },
  {
    path: '/',
    name: 'home',
    component: HomeView,
    children:[ //通过children配置子级路由
      {
        path:'/',
        name:'index',
        component:IndexView
      },
      {
        path:'search',
        name:'search',
        component:SearchView
    },
    {
        path:'register',
        component:RegisterView
    },
  ]
  },
  {
    path: '/account',
    name: 'account',
    component: AccountView,
    children:[ //通过children配置子级路由
    {
      path:'/account',
      name:'accindex',
      component:AccIndex
    },
    {
      path: '/address',
      name: 'address',
      component: AddressView
    }
  ]
  },
  {
    path: '/favourites',
    name: 'favourites',
    component: FavouritesView
  },
  {
    path: '/about',
    name: 'about',
    component: AboutView
  },
  
  
]

const router = createRouter({
  history: createWebHashHistory(),
  linkActiveClass: 'link-active',
  routes
})

export default router
